Add_UI_Test/Cypress/Basic_tests#190
Add_UI_Test/Cypress/Basic_tests#190Lisafiluz wants to merge 42 commits intoPythonFreeCourse:developfrom
Conversation
…nto add-cypress
…into add-cypress
Delete user
…into add-cypress
delete-user\add-confirmation
delete-user/fix_comments
…into add-cypress
UI-tests/Add_cypress
…into add-cypress
Add cypress
|
Are cypress/support and cypress/plugins necessary? |
|
cypress/support handles all the logic of the commands (functions to doings things in the UI) and services (functions to doings things with requests - directly to the server) cypress/plugins in not necessary for now, but I'll continue to write tests when the most of the UI functionality will merge to dev so if it never be used I'll delete it. |
| //cy.url().should('include', '/signIn') | ||
|
|
||
| //cy.get('.signIn_input[name=email]') | ||
| //.type('fake@email.com') | ||
| //.should('have.value', 'fake@email.com') |
| beforeEach(() => { | ||
| //cy.logIn(true); | ||
| }) | ||
|
|
||
| after(() => { | ||
| //cy.logOut(); | ||
| }) |
There was a problem hiding this comment.
Is this needed? If not, remove the code
There was a problem hiding this comment.
it will be needed, I created the basic template for the tests after the functionality will come its going to be used
| beforeEach(() => { | ||
| //cy.logIn(true); | ||
| }) | ||
|
|
||
| after(() => { | ||
| //cy.logOut(); | ||
| }) |
There was a problem hiding this comment.
Is this needed? If not, remove the code
| @@ -0,0 +1,21 @@ | |||
| /// <reference types="cypress" /> | |||
| // *********************************************** | ||
| // This example commands.js shows you how to |
|
Hey, another point which is worth fixing is the file names. The Google JavaScript Style Guide says:
So your files such as "ProfilePage/cy_User_Card_Actions.js" should be renamed and I'd say to lowercase, to match our *.py files. |
| Cypress.Commands.add("loginError", (user,password) => { | ||
| login(user,password); | ||
| cy.get('.callout').should('contain', 'Incorrect username or password'); | ||
| }) | ||
|
|
There was a problem hiding this comment.
If I understood this command correctly, it tests if the message contains that specific text. This test will fail if we translate the message (and we are). Can you check for status code instead maybe?
There was a problem hiding this comment.
when the login will merge ill check it, for now when we dont yet have login its not called
| Cypress.Commands.add("logoutUI", () => { | ||
| cy.get(".icon-account_circle").click(); | ||
| cy.get(".icon-sign-out").click(); | ||
| cy.get('.btn').should('be.visible'); | ||
|
|
||
| }) No newline at end of file |
There was a problem hiding this comment.
I looked at the Cypress documentation for their recommended best practices , and they list from worst to best how to select an element. They discourage selecting by tags, classes or IDs:
Targeting the element above by tag, class or id is very volatile and highly subject to change. You may swap out the element, you may refactor CSS and update ID’s, or you may add or remove classes that affect the style of the element.
Instead, adding the data-cy attribute to the element gives us a targeted selector that’s only used for testing.
The data-cy attribute will not change from CSS style or JS behavioral changes, meaning it’s not coupled to the behavior or styling of an element.
Additionally, it makes it clear to everyone that this element is used directly by test code.
I think we should follow their recommendation here, as I can already see how every small fix in the a css or id name will lead to errors here (I commented on this line, but this is a general comment for how we access selectors in the PR).
There was a problem hiding this comment.
we dont have logout yes, Ill add data-cy attribute when we will have logout functionality
There was a problem hiding this comment.
Great :) but that was just one example. In tests/tests-ui/cypress/support/enums/enums_profilePage.js you also use this style
…into add-cypress
Codecov Report
@@ Coverage Diff @@
## develop #190 +/- ##
===========================================
+ Coverage 95.15% 99.36% +4.21%
===========================================
Files 76 36 -40
Lines 3382 1418 -1964
===========================================
- Hits 3218 1409 -1809
+ Misses 164 9 -155
Continue to review full report at Codecov.
|
|
Conflicts fixed |
| <<<<<<< HEAD | ||
| new_user=Depends(get_placeholder_user), | ||
| new_event=Depends(get_placeholder_event)): | ||
|
|
||
| ======= | ||
| new_user=Depends(get_placeholder_user)): | ||
| >>>>>>> b91708d299bde83bbd10ff93496b23af9d35dd8f |
No description provided.